<?php 
/*
**模型：网站信息
**model/class.option.php
**By QINIAO
*/

class qiOption{
	var $db;
	
	function qiOption($dbhandle)
	{
		$this->db = $dbhandle;
	}

	//获取网站信息
    function getOption()
	{
	$res = $this->db->query("select * from ".DB_PREFIX."options");
	$row = $this->db->fetch_array($res);
	$options = array();
	if($row)
	{
	$options = array(
	'sitename' => $row['sitename'],
	'sitetitle' => $row['sitetitle'],
	'sitekey' => $row['sitekey'],
	'sitedesc' => $row['sitedesc'],
	'siteurl' => $row['siteurl'],
	'siteicp' => $row['siteicp'],
	'siteoff' => $row['siteoff'],
	'siteoffw' => $row['siteoffw'],
	'sitereg' => $row['sitereg'],
	'siteregw' => $row['siteregw'],
	'sitecount' => $row['sitecount']
	);
	}
    return $options;	
	}
	//更新网站信息
	function updateOption($upDate)
	{
	$Item = array();
	foreach($upDate as $key=>$date)
	{
	$Item[] = "$key='$date'";
	}
	$upStr = implode(',',$Item);
	$this->db->query("update ".DB_PREFIX."options set $upStr");
	}

	}

?>